from osv import fields,osv
import mx.DateTime
import tools.sql
from tools.translate import _

class kdvn_report_contract_to_client(osv.osv):
    _name='kdvn.report.contract.to.client'
    _description='KDVN Report Contract To Client'
    _auto=False
    
    _columns={
                "contract_no":fields.char("Contract No.",size=25),
                "project_name":fields.char("Project Name",size=20),
                "description":fields.char("Payment No.",size=255),
                "contract_currency":fields.many2one('project.currency',"Contract Cur."),
                'payment_id':fields.many2one("kdvn.payment.from.client",'Payment'),
                "contract_id":fields.integer('Contract ID'),
                "quotation_info":fields.char("Payment No.",size=255),
                
                "direct_amount":fields.float("Contract Amount"),
                "vat":fields.float("Contract VAT"),
                "total_amount":fields.float("Contract Total"),
                
                "payment_number":fields.char("Payment No.",size=20),
                "claim_date":fields.date("Claim Date"),
                "claim_amount":fields.float("Claim Amount"),
                "received_date":fields.date("Received Date"),
                "received_amount":fields.float('Received Amount'),
                "red_invoice_ok":fields.boolean('VAT OK?'),
                "payment_term_line_id":fields.many2one('kdvn.payment.term.line','Payment Term Line'),
                
                "completion_date":fields.date('Completion Date'),
                "contract_sent":fields.boolean("Contract Sent?"),
                "contract_received":fields.boolean("Contract Received?"),
                
                "progress_sent":fields.boolean("Progress Sent?"),
                "progress_received":fields.boolean("Progress Received?"),
                
                "electrical":fields.float("Electrical"),
                "mechanical":fields.float("Mechanical"),
                "discount":fields.float("Discount")
              }
kdvn_report_contract_to_client()

class kdvn_contract_client(osv.osv):
    _name = 'kdvn.contract.client'
    _inherit = 'kdvn.contract.client'
    _description="KDVN Contract Client"
    
    _columns={
              'contract_client_report_id':fields.one2many('kdvn.report.contract.to.client','contract_id','Contract Client Report')
              } 
kdvn_contract_client()